<?php
$place		= gpc_getIntGet("place",-1);
$status		= gpc_getIntGet("status",-1);

$advertises=ListAdvertise($place,$status);

function ListAdvertise($place=0,$status="-1")
{
global $dbsql,$language,$urlplace,$urlstatus;
	$advertises=array();

	$sql_select = "select * from tbladvertise where (cLanguage='all' or cLanguage='$language') ";

	if($place>0)
	{
		$sql_select .= " and iPlace='$place' ";
		$urlplace="place=".$place."&";
	}
	if($status!="-1")
	{
		$sql_select.= " and iStatus='$status' ";
		$urlstatus="status=".$status."&";
	}
	$sql_select.="  order by iPlace,iOrder";
	$rs=$dbsql->query($sql_select);

	while ( $result = $dbsql->fetch_array($rs) )
	{
		$advertises[]=$result;
	}
	return $advertises;
}

?>